package com.demo.controller;

import com.demo.Vo.LogsVO;
import com.demo.config.express.logistics.LogisticsUtil;
import com.demo.service.TestService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author admin
 */
@RestController
@RequestMapping("/test")
@AllArgsConstructor
public class TestController {

	private final TestService testService;

	@GetMapping("/qq")
	public String insert() {
		return testService.insert();
	}

	@GetMapping("/list")
	public List<LogsVO> list() {
		return testService.selectList();
	}

	@Autowired
	private static LogisticsUtil logisticsUtil;

	public static void main(String[] args) {
		// ThreadLocal<String> objectThreadLocal = new ThreadLocal<>();
		// objectThreadLocal.set("123456789");
		// String aaa="1212";
		// StringBuilder stringBuilder = new StringBuilder();
		// stringBuilder.append("111111");
		// stringBuilder.append("22222");
		// System.out.println("主stringBuilder"+stringBuilder);
		// Thread thread = new Thread(() -> {
		//
		// stringBuilder.append("3333");
		// System.out.println("stringBuilder"+stringBuilder);
		// System.out.println("aaaaaaaa"+aaa);
		// System.out.println("子主线程"+objectThreadLocal.get());
		// objectThreadLocal.set("987654321");
		// System.out.println("子线程"+objectThreadLocal.get());
		// });
		// thread.start();
		//// thread.join();
		// System.out.println("主线程"+objectThreadLocal.get());
		//
		// stringBuilder.append("4444");
		// System.out.println("主stringBuilder"+stringBuilder);
		// System.out.println("主aaaaaaaa"+aaa);
		// objectThreadLocal.remove();
		// System.out.println(objectThreadLocal.get());

		// 物流查询
		logisticsUtil.queryWuLiu("SF1376988119102");

	}

	@RequestMapping("querywuliu")
	public String queryWuliu(String no) {
		return logisticsUtil.queryWuLiu(no);
	}

}
